{% set clazz = "expressd"; %}
{% set title = "配送单详情" %}
{% extends './modules/common/templates/main.html' %}
{% block style %}
  <link rel="stylesheet" href="{{ '/static/css/delivery.css'|version }}" />
{% endblock %}
{% block content %}
  {% if !nested %}
    <header class="bar bar-header">
      {{ macro.back() }}
      <h1>{{ title }}</h1>
    </header>
  {% endif %}
  <section>
  <div class="list compact overlap">
    <a class="item" href="/delivery/status/{{entity.id}}" style="background: #f7f7f7;">
      <span class="pull-left text-gray"><i class="icon">&#xe60c;</i>&nbsp;{{entity.postDate}}</span>
      <span class="text">
        <div class="text-right text-orange">
        {{entity.status | deliveryStatusFilter}}
        <i class="icon text-gray">&#xe61a;</i>
        </div>
      </span>
    </a>
    {% if entity.postmanMobile && entity.status != 4 && entity.status != 6 && entity.status != 8 %}
    <div class="item">
      <span class="pull-left">接单管家电话：</span>
      <span class="text">
        <div class="text-right text-orange">{{entity.postmanMobile}}</div>
      </span>
    </div>
    {% endif %}
    <div class="item">
      <div class="text text-sm">
        <div class="text">
          <span class="text text-sm">配送社区：</span>
          <span class="text text-sm text-gray">{{entity.regionName}}-{{entity.projectName}}</span>
        </div>
        <div class="text">
          <span class="text text-sm">配送时间：</span>
          <span class="text text-sm text-gray"> {{entity.postDate}} {{entity.postWeek}} {{entity.postPeriod | postPeriodFilter}}</span>
        </div>
        <div class="text">
          <span class="text text-sm">配送地址：</span>
          <span class="text text-sm text-gray">{{entity.address}}</span>
        </div>
      </div>
    </div>
  </div>

  <div class="list">
    <div class="item-divider"></div>
  </div>

  <div class="list">
    <div class="item" style="background: #f7f7f7;">
         <i class="icon">&#xe60c;</i>&nbsp;快递明细
    </div>
    <div class="item">
      <!-- <i class="icon">&#xe60c;</i> -->
      <div class="text text-sm">
        <div class="text">
          <span class="text text-sm">快递数量：</span>
          <span class="text text-sm text-gray">{{entity.courierCount}}</span>
        </div>
        <div class="text">
          <span class="text text-sm">配送单号：</span>
          <span class="text text-sm text-gray"> {{entity.code}}</span>
        </div>
        <div class="text">
          <span class="text text-sm">奖励积分：</span>
          <span class="text text-sm text-gray">{{entity.integralCountCost}}</span>
        </div>
      </div>
    </div>
    {% for detail in entity.courier4AppList %}
    <a class="item" href="/delivery/details/{{detail.id}}">
      <div class="text text-md">
        寄件人：<span class="text">{{detail.sendName || '未知'}}</span>
        <div class="brief">
          <span class="text">{{detail.companyName}}：</span>
          <span class="text">{{detail.courierCode}}</span>
        </div>
      </div>
      <i class="icon text-gray">&#xe61a;</i>
    </a>
    {% endfor %}
  </div>
  
  </section>
  <footer class="bar bar-footer bar-fixed bar-flat">
    <div class="footer clearfix" style="width: 100%;">
      <div class="button-group">
      {% if entity.status == 5 || entity.status == 8 %}
          <a data-code="{{entity.code}}" class="button primary light inline little scaner-back">扫码归还</a>
        {% endif %}

        {% if entity.status == 0 %}
          <a  data-grabid="{{entity.id}}" data-projectid="{{entity.projectId}}"  class="button primary light inline little grabexpress">抢单</a>
        {% endif %}

        {% if entity.dispatchStatus == 11 %}
        <a href="tel:{{entity.createMobile}}" class="button inline default little">联系用户</a>
        {% endif %}

        {% if entity.dispatchStatus == 10 || entity.dispatchStatus == 11 %}
        <button data-curid="{{entity.id}}" class="button inline default little cancel-dispatch">取消配送</button>
        {% endif %}

        {% if entity.dispatchStatus == 10 %}
        <button class="button primary light inline little scanner-get" data-code="{{entity.code}}">扫码领取</button>
        {% endif %}
        
        {% if entity.dispatchStatus == 11 %}
        <button data-curid="{{entity.id}}" class="button primary light inline little  scaner-qianshou">扫码签收</button>
        {% endif %}
      </div>
    </div>
  </footer>
{% endblock %}
{% block script %}
  {% parent %}
  <script src="{{ '/static/js/delivery.js'|version }}"></script>
{% endblock %}